home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 22 / Cream of the Crop 22.iso / program / eflibpt4.zip / DEMO / STREAMS / STRMCOPY.PAS < prev    next >
Pascal/Delphi Source File  |  1996-08-14  |  1KB  |  29 lines

  1. { Borland Pascal Extended Function Library - EFLIB (C) Johan Larsson, 1996
  2.   Demonstration; moving data between streams; simple file copying
  3.  
  4.   EFLIB IS PROTECTED BY THE COPYRIGHT LAW AND MAY NOT BE COPIED, SOLD OR
  5.   MANIPULATED. FOR MORE INFORMATION, SEE PROGRAM MANUAL! THIS DEMONSTRAT-
  6.   ION PROGRAM MAY FREELY BE USED AND DISTRIBUTED.                          }
  7.  
  8.  
  9. uses EFLIBIO;
  10.  
  11. var FirstStream, SecondStream : StreamObjectPointerType; Storage : string;
  12.  
  13.  
  14. begin
  15.      FirstStream := New (FileStreamObjectPointerType, Initialize (ParamStr(1), 100));
  16.      SecondStream := New (FileStreamObjectPointerType, Initialize (ParamStr(2), 100));
  17.  
  18.      FirstStream^.MoveOut (SecondStream, FirstStream^.Size);
  19.  
  20.      { The above MoveOut call could be replaced with the following;
  21.  
  22.           Storage[0] := #255;
  23.           while not FirstStream^.IsEnd do begin
  24.                 FirstStream^.Read (Storage[1], 255);
  25.                 SecondStream^.Write (Storage[1], FirstStream^.LastTransfer);
  26.           end; }
  27.  
  28.      FirstStream^.Free; SecondStream^.Free;
  29. end.